package org.codetranslators.common;

public class Edge {

	private Node src;
	private Node destination;
	private boolean directed;
	private int positionInGraph;

	public Edge(Node src, Node dest) {
		this.src = src;
		this.destination = dest;
	}

	public Node getOppositeNode(Node node) {
		if (node == src)
			return destination;
		else
			return src;

	}

	public Node getDestination() {
		return destination;
	}

	public void setDestination(Node destination) {
		this.destination = destination;
	}

	public boolean isDirected() {
		return directed;
	}

	public void setDirected(boolean directed) {
		this.directed = directed;
	}

	public int getPositionInGraph() {
		return positionInGraph;
	}

	public void setPositionInGraph(int positionInGraph) {
		this.positionInGraph = positionInGraph;
	}

	public Node getSrc() {
		return src;
	}

	public void setSrc(Node src) {
		this.src = src;
	}

	public void display() {
		if (directed)
			System.out.println("Src = " + src.getName() + " Dest = "
					+ destination.getName());
		else
			System.out.println("First Node = " + src.getName()
					+ " Second Node = " + destination.getName());
	}
}
